styleproperty: Add _gtk_style_property_query()
authorBenjamin Otte <otte@redhat.com>
Sat, 31 Dec 2011 00:14:47 +0000 (01:14 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 9 Jan 2012 17:37:51 +0000 (18:37 +0100)
This way, we only need to export one function, not 3.

gtk/gtkstyleproperties.c
gtk/gtkstyleproperty.c
gtk/gtkstylepropertyprivate.h

index 08ed39bcf9df49155e94d049ed9bec72ba1adb42..48dc88b11eb99a00a20ffe5a8511d4ad8665ddda 100644 (file)
@@ -744,7 +744,6 @@ _gtk_style_properties_get_property (GtkStyleProperties *props,
                                    GValue             *value)
 {
   const GtkStyleProperty *node;
-  const GValue *val;
 
   g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
   g_return_val_if_fail (property != NULL, FALSE);
@@ -757,16 +756,7 @@ _gtk_style_properties_get_property (GtkStyleProperties *props,
       return FALSE;
     }
 
-  val = _gtk_style_properties_peek_property (props, node, state);
-  g_value_init (value, node->pspec->value_type);
-
-  if (val)
-    _gtk_style_property_resolve (node, props, state, context, (GValue *) val, value);
-  else if (_gtk_style_property_is_shorthand (node))
-    _gtk_style_property_pack (node, props, state, context, value);
-  else
-    _gtk_style_property_default_value (node, props, state, value);
-
+  _gtk_style_property_query (node, props, state, context, value);
   return TRUE;
 }
 
index d139b9da85aab2b88d9205dce3fef296076434ec..fb1ca2496c35a7fc9c9b75724f821c68e3ae6a80 100644 (file)
@@ -33,6 +33,7 @@
 #include "gtkcssparserprivate.h"
 #include "gtkcsstypesprivate.h"
 #include "gtkprivatetypebuiltins.h"
+#include "gtkstylepropertiesprivate.h"
 
 /* the actual parsers we have */
 #include "gtkanimationdescription.h"
@@ -2440,7 +2441,7 @@ _gtk_style_property_print_value (const GtkStyleProperty *property,
   func (value, string);
 }
 
-void
+static void
 _gtk_style_property_default_value (const GtkStyleProperty *property,
                                    GtkStyleProperties     *properties,
                                    GtkStateFlags           state,
@@ -2565,7 +2566,7 @@ resolve_shadow (GtkStyleProperties *props,
   return TRUE;
 }
 
-void
+static void
 _gtk_style_property_resolve (const GtkStyleProperty *property,
                              GtkStyleProperties     *props,
                              GtkStateFlags           state,
@@ -2668,7 +2669,7 @@ _gtk_style_property_unpack (const GtkStyleProperty *property,
   return property->unpack_func (value, n_params);
 }
 
-void
+static void
 _gtk_style_property_pack (const GtkStyleProperty *property,
                           GtkStyleProperties     *props,
                           GtkStateFlags           state,
@@ -2683,6 +2684,31 @@ _gtk_style_property_pack (const GtkStyleProperty *property,
   property->pack_func (value, props, state, context);
 }
 
+void
+_gtk_style_property_query (const GtkStyleProperty  *property,
+                           GtkStyleProperties      *props,
+                           GtkStateFlags            state,
+                          GtkStylePropertyContext *context,
+                           GValue                  *value)
+{
+  const GValue *val;
+
+  g_return_if_fail (property != NULL);
+  g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
+  g_return_if_fail (context != NULL);
+  g_return_if_fail (value != NULL);
+
+  val = _gtk_style_properties_peek_property (props, property, state);
+  g_value_init (value, property->pspec->value_type);
+
+  if (val)
+    _gtk_style_property_resolve (property, props, state, context, (GValue *) val, value);
+  else if (_gtk_style_property_is_shorthand (property))
+    _gtk_style_property_pack (property, props, state, context, value);
+  else
+    _gtk_style_property_default_value (property, props, state, value);
+}
+
 #define rgba_init(rgba, r, g, b, a) G_STMT_START{ \
   (rgba)->red = (r); \
   (rgba)->green = (g); \
index e34c20859bdb5645594e9df7f860f59e86e6a886..4f5902ab929904783bcc8c87949c9f5b3fd8730d 100644 (file)
@@ -78,29 +78,13 @@ void                     _gtk_style_property_register      (GParamSpec
 gboolean                 _gtk_style_property_is_inherit    (const GtkStyleProperty *property);
 guint                    _gtk_style_property_get_id        (const GtkStyleProperty *property);
 
-void                     _gtk_style_property_default_value (const GtkStyleProperty *property,
-                                                            GtkStyleProperties     *properties,
-                                                            GtkStateFlags           state,
-                                                            GValue                 *value);
 const GValue *           _gtk_style_property_get_initial_value
                                                            (const GtkStyleProperty *property);
 
-void                     _gtk_style_property_resolve       (const GtkStyleProperty *property,
-                                                            GtkStyleProperties     *properties,
-                                                            GtkStateFlags           state,
-                                                           GtkStylePropertyContext *context,
-                                                            GValue                 *orig_value,
-                                                            GValue                 *out_value);
-
 gboolean                 _gtk_style_property_is_shorthand  (const GtkStyleProperty *property);
 GParameter *             _gtk_style_property_unpack        (const GtkStyleProperty *property,
                                                             const GValue           *value,
                                                             guint                  *n_params);
-void                     _gtk_style_property_pack          (const GtkStyleProperty *property,
-                                                            GtkStyleProperties     *props,
-                                                            GtkStateFlags           state,
-                                                           GtkStylePropertyContext *context,
-                                                            GValue                 *value);
 
 gboolean                 _gtk_style_property_parse_value   (const GtkStyleProperty *property,
                                                             GValue                 *value,
@@ -110,6 +94,12 @@ void                     _gtk_style_property_print_value   (const GtkStyleProper
                                                             const GValue           *value,
                                                             GString                *string);
 
+void                     _gtk_style_property_query         (const GtkStyleProperty *property,
+                                                            GtkStyleProperties     *props,
+                                                            GtkStateFlags           state,
+                                                           GtkStylePropertyContext *context,
+                                                            GValue                 *value);
+
 G_END_DECLS
 
 #endif /* __GTK_CSS_STYLEPROPERTY_PRIVATE_H__ */